#include "mini.kit.h"
#include <stdio.h>
#include <stdlib.h>
#include <sstream>

int main(int argc, char* argv[])
{
	if(argc<2)
	{
		fprintf(stderr, "usage: %s config-file-path\n", argv[0]);
		return -1;
	}

	MINIKIT::Config conf( argv[1] );
	if( conf.reload()<0 )
	{
		fprintf(stderr, "failed to load config: %s\n", argv[1]);
		return -1;
	}

	std::stringstream ss;
	conf.output( ss );
	fprintf( stdout, "#-----output-begin-----\n" );
	fprintf( stdout, "%s\n", ss.str().c_str() );
	fprintf( stdout, "#-----output-end-------\n" );

	std::string sec;
	std::string key;

	sec = "VIP_PAYID";
	key = "name_4";
	fprintf( stdout, "[%s]%s=%s\n", sec.c_str(), key.c_str(), conf.getStr( sec, key, "233").c_str() );

	sec = "BACKEND";
	key = "stamp32";
	fprintf( stdout, "[%s]%s=%d\n", sec.c_str(), key.c_str(), conf.getInt32( sec, key, 233) );

	sec = "BACKEND";
	key = "stamp64";
	fprintf( stdout, "[%s]%s=%llu\n", sec.c_str(), key.c_str(), conf.getInt64( sec, key, 233) );

	sec = "BACKEND";
	key = "stamp61";
	fprintf( stdout, "[%s]%s=%llu\n", sec.c_str(), key.c_str(), conf.getInt64( sec, key, 123321) );
	return 0;
} 

